<?php/*
Pro Clan Manager is a website manager for multiplayer game teams. Pro Clan manager was designed and built by Andrew Fenn.
Copyright (C) 2002 Andrew Fenn

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

/* How to setup your mod to install:

To allow your module to be installed by PCM you must have it in a folder in the mods directory. For example
"mods/joinform/". Instal this joinform folder you will require an install.php and an uninstall.php file. These two
files are responsible for installing and uninstalling your module. This includes any mysql_tables which need creating.

Below you will see information that every module should have.
 */

if (URANK_ADMIN == 1) /* Security check */
{

$mod_name = "Join Form";	// This is your mods name
$mod_Version = '1';		// This tells pcm the version of your script.

/* Below is a mysql query that will place the information above into the mysql database. If you are making 
your own mod you can just copy this. */

$sql = "INSERT into ".MYSQL_PREFIX."_modules (m_id, m_name, m_version, m_folder, m_status) VALUES ('', '".$mod_name."', '".$mod_Version."', '".$install."', '0')";
mysql_query($sql, CONNECT);

/* Whenever you make, add, change anything from a mysql table use the constant "MYSQL_PREFIX" which will give you the 
table prefix the user wants to use. 

The CONNECT constant is the mysql connection which is used through out the script.
*/

/* ADDING RANKS - There are no ranks involved in this module. */

/* ADDING LINKS - Links which will show up in the menu. */

/* Find out the mods id. This is different on every version so we'll look it up */

$sql = "SELECT m_id FROM ".MYSQL_PREFIX."_modules WHERE m_name = '".$mod_name."'";
$query = mysql_query($sql, CONNECT);
if ($row = mysql_fetch_array($query))
{
	$sql = "INSERT into ".MYSQL_PREFIX."_menu (l_id, l_name, l_link, l_type, m_id) VALUES ('', 'Join Form', 'modules.php?m=".$row['m_id']."&page=index', '2', '".$row['m_id']."')";
	mysql_query($sql, CONNECT);
}

/* 	l_name = The name of your link
	l_link = Your links address - modules.php?m=".$row['m_id']."&page=index - Lets break this down:
			- modules.php?m=".$row['m_id']." - This part till tell modules.php to load up your module folder
			- &page=index - This part will tell it which page to load in your module folder.

	So this is telling modules.php to load up the file index.php in this modules folder. Remember you can make as many links as you want.

	l_type = Which menu your link will go in. For example putting '1' would mean that your link would go
	into the members menu. If you put '2' your link would go into the public menu.
	m_id   = This is the id of your module so if user user disable your module your links don't show up.
*/

/* insert a view rank. This rank is import because it determines who gets the emails */

/* When we add a new rank we add it to the table pcm_rank_var . There are 4 attributes to this table.

v_id = The id, this is auto_incremented so you won't have to bother with this
v_name = The variable name. In this instance we'll be putting this as JOINFORM. When in use this will become URANK_JOINFORM.
m_id = This is your modules id. The variable for m_id is $row['m_id']
v_type = The type means where it shows up on the edit ranks
		0 = View
		1 = Add
		2 = Edit
		3 = Delete
*/

$sql = "INSERT into ".MYSQL_PREFIX."_rank_var (v_id, v_name, m_id, v_type) VALUES ('', 'JOINFORM', '".$row['m_id']."', '0')";
mysql_query($sql, CONNECT);

/* Any other tables - If you need to add any extra tables for your module you should do it here. */

}
?>